package com.schoolCommunity.util;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.schoolCommunity.entity.Member;

@Component
public class CheckLoginMember {


    Logger log = Logger.getLogger(CheckLoginMember.class);

    public String CheckLoginMember(Member Member) {

        log.info("进入了CheckLoginMember方法，检查传来的登录数据");

        if (!Member.getEmail().matches("^[A-Za-z0-9\\u4e00-\\u9fa5]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$")) {
            log.info("CheckLoginMember方法，检查到数据邮箱格式不正确");
            return "邮箱格式不正确";
        }

        if (Member.getEmail().length() >= 30) {
            log.info("CheckLoginMember方法，检查到邮箱过长");
            return "邮箱字符长度不能超过30个字符";
        }

        if (Member.getPassword().length() > 16) {
            log.info("CheckLoginMember方法，检查到密码过长");
            return "密码长度不能超过16个字符";
        }


        return "数据安全";

    }
}
